package com.zytlifeservice.util;

import com.zytlifeservice.domain.Result;

/**
 * Created by MJS on 2017/4/22.
 */
public class ResultUtil {

    public static Result success(Object o, String message) {
        Result result = new Result();
        result.setCode(0);
        result.setMessage(message);
        result.setData(o);
        return result;
    }

    public static Result success() {
        return success(null, "操作成功");
    }

    public static Result error(int code, String message) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

    public static Result error(int code, String message, Object o) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        result.setData(o);
        return result;
    }
}
